﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using WPCoco;

namespace CocoCube
{
    public class Layer3D : AffineNode
    {
        public Layer3D()
        {
            Anchor = Vector2.Zero;
            Width = Screen.Width; Height = Screen.Height;
            Camera = new Camera() { Position = new Vector3(0, 0, 5), Target = Vector3.Zero, Up = Vector3.Up };
        }

        #region 3D Node Addion

        public override void AddNode(Node node)
        {
            if (!(node is Node3D)) return;
            base.AddNode(node);
            ((Node3D)node).ParentLayer = this;            
        }

        public override void AddNode(Node node, int zOrder)
        {
            node.ZOrder = zOrder;
            AddNode(node, zOrder);
        }

        protected override void HasBeenRemoved(Node node)
        {
            ((Node3D)node).ParentLayer = null;
        }

        #endregion

        Camera camera = null;

        public Camera Camera
        {
            get { return camera; }
            set { camera = value; }
        }

    }
}
